<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>5.cors解决跨域_复杂请求</title>
</head>

<body>
    <button onclick="getStudents()">获取学生列表</button>

    <script type="text/javascript">
        async function getStudents() {
            const url = 'http://127.0.0.1:8080/students'
            let result = await fetch(url, {
                method: 'GET',
                headers: {
                    school: 'duyang',
                    // address: 'guangqumen'
                    // 'Content-Type': 'text/plain'
                    // 'Content-Type': 'multipart/form-data'
                    // 'Content-Type': 'application/x-www-form-urlencoded'
                    // 'Content-Type': 'application/json'
                }
            })
            let data = await result.json()
            console.log(data);
            console.log(result.headers.get('abc'));
            
        }
    </script>
</body>

</html>